#include "LogRec.h"

#include <string.h>
#include <fan-llvm/core/Core.h>
#include "Type.h"
#include "UnsupportedErr.h"


Type* LogRec_classType = NULL;
VTable* LogRec_classVTable = NULL;


/**********************************************
 *
 * Methods and fields
 *
 **********************************************/


/* Void make(DateTime time, LogLevel level, Str logName, Str message, Err? err) */
void LogRec_make_4(LogRec* self, DateTime* time, LogLevel* level, Str* logName, Str* message)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::LogRec.make not implemented yet"));
}


/* Void make(DateTime time, LogLevel level, Str logName, Str message, Err? err) */
void LogRec_make(LogRec* self, DateTime* time, LogLevel* level, Str* logName, Str* message, Err* err)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::LogRec.make not implemented yet"));
}


/* Str toStr() */
Str* LogRec_toStr(Obj self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::LogRec.toStr not implemented yet"));
}


/* DateTime time */
DateTime* LogRec_time(LogRec* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::LogRec.time not implemented yet"));
}


/* LogLevel level */
LogLevel* LogRec_level(LogRec* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::LogRec.level not implemented yet"));
}


/* Str logName */
Str* LogRec_logName(LogRec* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::LogRec.logName not implemented yet"));
}


/* Str msg */
Str* LogRec_msg(LogRec* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::LogRec.msg not implemented yet"));
}


/* Err? err */
Err* LogRec_err(LogRec* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::LogRec.err not implemented yet"));
}


/* Void print(OutStream out) */
void LogRec_print_0(LogRec* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::LogRec.print not implemented yet"));
}


/* Void print(OutStream out) */
void LogRec_print(LogRec* self, OutStream* out)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::LogRec.print not implemented yet"));
}


/**********************************************
 *
 * Type-system functions
 *
 **********************************************/


Type* LogRec_initType(void)
{
  if (LogRec_classType == NULL)
  {
    Type* baseType = Obj_initType();
    VTable* vtable = LogRec_initVTable();
    Type* type = Type_new("LogRec", baseType, vtable, sizeof(LogRec), sizeof(LogRecVTable));
    Type_registerCtorImplementation(type, "make", LogRec_make_4, 4);
    Type_registerCtorImplementation(type, "make", LogRec_make, 5);
    Type_registerMethodImplementation(type, "print", LogRec_print_0, 0);
    Type_registerMethodImplementation(type, "print", LogRec_print, 1);
    Type_registerMethodImplementation(type, "toStr", LogRec_toStr, 0);
    Type_registerFieldImplementation(type, "err", LogRec_err, NULL);
    Type_registerFieldImplementation(type, "level", LogRec_level, NULL);
    Type_registerFieldImplementation(type, "logName", LogRec_logName, NULL);
    Type_registerFieldImplementation(type, "msg", LogRec_msg, NULL);
    Type_registerFieldImplementation(type, "time", LogRec_time, NULL);
    LogRec_classType = type;
    LogRec_initStatic();
  }
  return LogRec_classType;
}


VTable* LogRec_initVTable(void)
{
  if (LogRec_classVTable == NULL)
  {
    VTable* vtable = memoryAlloc(sizeof(LogRecVTable));
    memcpy(vtable, Obj_initVTable(), sizeof(FanObjVTable));
    ((FanObjVTable*)vtable)->toStr = LogRec_toStr;
    LogRec_classVTable = vtable;
  }
  return LogRec_classVTable;
}


void LogRec_initStatic(void)
{
}
